_Pragma("once")

#include <memory>
#include <unistd.h>

#include "DeviceCommunicator.h"
#include "common.h"
#include "Log.h"

class SerialPortCommunicator : public DeviceCommunicator {
public:
    SerialPortCommunicator(const char * const deviceName = "/dev/ttymxc2");
    virtual ~SerialPortCommunicator();


     ssize_t read(const std::string& exceptionTip, void * buffer, const size_t length) noexcept override;

    int setPort(const std::string& exceptionTip, const int speed = 115200, const int bits = 8, const char event = 'N', const int stop = 1) noexcept;
//set_port(fd_uart, baud, 8, 'N', 1);

    int switchRs485(const bool enable)noexcept;

};



using SerialPortCommunicatorPtr = std::shared_ptr<SerialPortCommunicator>;
